package _06_动态规划;

public class _1014_最佳观光组合 {

    public static void main(String[] args) {

        _1014_最佳观光组合 v = new _1014_最佳观光组合();


        int[] ins = {2, 7, 7, 2, 1, 7, 10, 4, 3, 3};
        System.out.println(v.maxScoreSightseeingPair(ins));

    }

    // 装换成value[i] + i values[j] - j;
    public int maxScoreSightseeingPair(int[] values) {
        int left = values[0];
        int res = Integer.MIN_VALUE;
        for (int i = 1; i < values.length; i++) {
            res = Math.max(res, left + values[i] - i);
            left = Math.max(left, values[i] + i);
        }
        return res;
    }

}
